package com.neutech.neusys.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.neutech.neusys.service.SettleService;
import com.neutech.po.SettleCategory;



@RestController
@RequestMapping("/neusys/settle")
public class SettleController {
	@Autowired
	private SettleService settleService;
	@RequestMapping(value="/getSettleClass",method=RequestMethod.POST)
	public List<SettleCategory> getSettleClass(String info){
		System.out.println(info);
		return settleService.querySettleClass(info);
	}
	@RequestMapping(value="/addNewSettleClass",method=RequestMethod.POST)
	public String addNewSettleClass(SettleCategory settleCategory){
		int result =  settleService.addSettleClass(settleCategory);
		if(result == 1){
			return "success";
		}else{
			return "error";
		}
	}
	@RequestMapping(value="/updateNewSettleClass",method=RequestMethod.POST)
	public String updateNewSettleClass(SettleCategory settleCategory){
		int result =  settleService.updateSettleClass(settleCategory);
		if(result == 1){
			return "success";
		}else{
			return "error";
		}
	}
	@RequestMapping(value="/deleteSettleClass",method=RequestMethod.POST)
	public String deleteSettleClass(SettleCategory settleCategory){
		int result =  settleService.deleteSettleClass(settleCategory);
		if(result == 1){
			return "success";
		}else{
			return "error";
		}
	
	}
}
